import { Comm } from "../utils/common";
class User extends Comm {
    constructor() {
        super();
        this.getAmountData = {
            Page: 1,
            PageSize: 20
        }
        this.getMytopicData = {
            Page:1,
            PageSize: 15
        }
        this.getMyFollowData = {
            Page: 1,
            PageSize: 15
        }
        this.getMyCommentData = {
            Page: 1,
            PageSize: 15
        }
    };
    /**
     * 静默登录
     */
    login(options) {
        return new Promise((resolve, reject) => {
            let props = {
                url: "/gateway/api/login/wxOpen",
                type: "GET",
                data: options,
                sCallBack: res => {
                    resolve(res);
                },
                eCallBack: err => {
                    reject(err);
                }
            }
            this.request(props);
        });
    };
    /**
     * 授权登录
     */
    auth(options) {
        return new Promise((resolve, reject) => {
            let props = {
                url: "/gateway/api/user/setInfo",
                data: options,
                type: "GET",
                sCallBack: res => {
                    resolve(res);
                },
                eCallBack: err => {
                    reject(err);
                }
            }
            this.request(props);
        });
    };
    /**
     * 获取用户信息
     */
    getUserInfo() {
        return new Promise((resolve, reject) => {
            let props = {
                url: "/gateway/api/user/info",
                type: "GET",
                sCallBack: res => {
                    resolve(res);
                },
                eCallBack: err => {
                    reject(err);
                }
            }
            this.request(props);
        });
    };
    /**
     * 我的帖子
     */
  getMyTopics(options) {
    this.getMytopicData.Page = options.type == "first" ? 1 : this.getMytopicData.Page + 1;
        return new Promise((resolve, reject) => {
            let props = {
                url: "/gateway/api/my/postList",
                type: "GET",
                data:this.getMytopicData,
                sCallBack: res => {
                    resolve(res);
                },
                eCallBack: err => {
                    reject(err);
                }
            }
            this.request(props);
        });
    };
    /**
     * 我的关注
     */
  getMyFollow(options) {
    this.getMyFollowData.Page = options.type == "first" ? 1 : this.getMyFollowData.Page + 1;
        return new Promise((resolve, reject) => {
            let props = {
                url: "/gateway/api/my/followList",
                type: "GET",
                data:this.getMyFollowData,
                sCallBack: res => {
                    resolve(res);
                },
                eCallBack: err => {
                    reject(err);
                }
            }
            this.request(props);
        });
    };
    /**
     * 我的评论
     */
  getMyComment(options) {
    this.getMyCommentData.Page = options.type == "first" ? 1 : this.getMyCommentData.Page + 1;
        return new Promise((resolve, reject) => {
            let props = {
                url: "/gateway/api/my/commentList",
                type: "GET",
                data:this.getMyCommentData,
                sCallBack: res => {
                    resolve(res);
                },
                eCallBack: err => {
                    reject(err);
                }
            }
            this.request(props);
        });
    };
    /**
     * 积分明细
     */
    getAmountList(options) {
        this.getAmountData.Page = options.type == "first" ? 1 : this.getAmountData.Page + 1;
        return new Promise((resolve, reject) => {
            let props = {
                url: "/gateway/api/amount/list",
                type: "GET",
                data: this.getAmountData,
                sCallBack: res => {
                    resolve(res);
                },
                eCallBack: err => {
                    reject(err);
                }
            }
            this.request(props);
        });
    };
    /**
     * 举报
     */
    report(options){
      return new Promise((resolve,reject)=>{
        let props = {
          url:"/gateway/api/user/report",
          data:options,
          sCallBack:res=>{
            resolve(res);
          },
          eCallBack:err=>{
            reject(err);
          }
        }
        this.request(props);
      });
    }
}

export { User }